export default function createElement (type, props, ...children) {
  // 使用concat将children进行一层拷贝，使用reduce去掉一些不在页面展示的节点， true || false || null
  const childElements = [].concat(...children).reduce((result, child) => {
    if (![true, false, null].includes(child)) {
      if (typeof child === 'object') {
        result.push(child)
      } else {
        result.push(createElement('text', { textContent: child })) 
      }
    }
    return result
  }, [])
  return {
    type,
    props: Object.assign({}, { children: childElements }, props),
    children: childElements
  }
}